Repository navigation
fix(ssh): resolve the SSH config with ssh -G and forward the session type with SendEnv - #1197
Merged
Merged
Conversation
EhabY
force-pushed
the
fix/vsc-8-ssh-g-remote-command
branch
3 times, most recently
from
November 17, 2026 14:37
bbb0962 to
07b4e92
Compare
EhabY
marked this pull request as ready for review
November 18, 2026 14:52
EhabY
force-pushed
the
fix/vsc-8-ssh-g-remote-command
branch
from
November 18, 2026 14:53
07b4e92 to
0e40ec3
Compare
EhabY
force-pushed
the
fix/vsc-8-ssh-g-remote-command
branch
from
November 19, 2026 10:58
113b5a2 to
880f53f
Compare
EhabY
force-pushed
the
fix/vsc-8-ssh-g-remote-command
branch
from
November 20, 2026 11:24
9bb15bf to
2e22f05
Compare
…type with SendEnv After writing the generated SSH config, the extension resolved the Coder host's options with a manual parser that ignores `Include`, `Match` and negated `Host` lines, so a `RemoteCommand` from any of them went undetected. The host is now resolved with `ssh -G`, using the ssh executable the active Remote-SSH extension is configured with. If ssh fails, the extension falls back to the parser.
EhabY
force-pushed
the
fix/vsc-8-ssh-g-remote-command
branch
from
November 23, 2026 09:56
2e22f05 to
65cfabe
Compare
A deployment's SendEnv forwards local environment variables to the workspace, and SetEnv (OpenSSH 10+), User and RemoteForward expand ${VAR} into values sent to it; RemoteForward can also forward local sockets. These are dropped from the deployment's options, logged, and listed in a warning that Don't Show Again hides per deployment until a new option appears. The user's own options are written as given, so the session type SetEnv filter is gone.
ssh -G now falls back to the parser when it resolves no ProxyCommand, meaning it never read the Coder config. The CHANGELOG entries move out of the released v1.18.2 section.
Closes VSC-52.
EhabY
force-pushed
the
fix/vsc-8-ssh-g-remote-command
branch
from
November 23, 2026 10:54
997c2a2 to
cb0bf7b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After writing the generated SSH config, the extension resolved the Coder host's options with a manual parser that ignores
Include,Matchand negatedHostlines, so aRemoteCommandfrom any of them went undetected. The host is now resolved withssh -G, using the ssh executable the active Remote-SSH extension is configured with. If ssh fails, the extension falls back to the parser.Also in this PR:
PermitLocalCommand no: the generated block sets it, so aLocalCommandelsewhere in the user's config never runs for workspaces.SendEnvinstead ofSetEnv: the session type is set in the environment ssh inherits and forwarded withSendEnv. This works on every OpenSSH version, so thessh -Vcheck is gone.SendEnvforwards local environment variables,SetEnv(OpenSSH 10+),UserandRemoteForwardexpand${VAR}into values sent to the workspace, andRemoteForwardcan also forward local sockets such as the Docker socket. They are dropped from the deployment's options, logged, and listed in a warning. "Don't Show Again" hides it per deployment until a new option appears. The user's own options fromcoder.sshConfigorcoder config-ssh -oare written as given.remote.devinSSH.configFileto ssh, so Coder hosts go into that file there.Refs VSC-8. Closes VSC-52. The post-write check VSC-8 describes was already removed in #1061.
Decision log
ssh -G.-Fonly when Remote-SSH passes it:-Fmakes ssh skip/etc/ssh/ssh_config, sossh -Greads the same files the connection does.remote.SSH.path(Microsoft, Cursor, open-remote-ssh in native mode),remote.devinSSH.pathandremote.antigravitySSH.path.ssh -Gfails and is logged, then the parser takes over. It never silently runs a different ssh from PATH.SendEnv: I checked against a real sshd that it delivers the same value asSetEnv. Every extension spawns ssh withprocess.env. open-remote-ssh's defaultssh2backend ignoredSetEnvand exportsSendEnvvalues in its setup script instead of sending them, so the agent still sees a plain SSH session there, as onmain: SendEnv is exported in the setup script instead of sent as SSH env requests (ssh2 backend) jeanp413/open-remote-ssh#415.ValidateSSHConfigOptionaccepts them, so rejecting them likeDENIED_DEPLOYMENT_KEYSwould block connections to deployments that set them today. They are dropped even when the user sets the same key, becauseSetEnvandSendEnvaccumulate and the deployment's values would otherwise be written next to the user's. I checked the expansion withssh -Gon OpenSSH 9.5 and 10.3;HostName,HostKeyAliasandTagdo not expand environment variables.LocalForwardexpands${VAR}in its target, but that only reaches the workspace when a local client connects to the forwarded port, so it is kept.ForwardAgent,DynamicForwardandForwardX11Trustedalso expose the client but have legitimate deployment-wide uses, so they are left for a follow-up.Userchanges nothing. An admin who setSendEnvfor locale or a deployment-wideRemoteForward(for example, for GPG) loses it, sees the warning, and can move it tocoder.sshConfig.SendEnvvalues beforeSetEnvvalues, so a user'sSetEnv CODER_SSH_SESSION_TYPE=…replaces ours. That is the user's choice about their own machine, so it is not filtered. The# :ssh-option=lines read from thecoder config-sshblock hold only the user's-oflags; the CLI merges deployment options separately.Generated by Coder Agents on behalf of @EhabY.
🤖 Generated with Claude Code